/**
 * 
 */
package com.da.util;

import java.util.HashMap;
import java.util.Map;

import com.ra.landlord.constant.LandlordConstant;
import com.ra.landlord.constant.RoomType;

/**
 * 批量导入工具类
 * @author Jebel Qin
 * @date 2015年9月19日
 * @since v4.0
 */
public class RoomImportUtils 
{
	private static Map<String, Integer> roomTypeMap = new HashMap<String, Integer>();
	
	private static Map<String, Integer> rentTypeMap = new HashMap<String, Integer>();
	
	private static Map<String, Integer> genderTypeMap = new HashMap<String, Integer>();
	
	static
	{
		//roomType
		roomTypeMap.put("单间", RoomType.RTM_1R_0H);
		roomTypeMap.put("一房一厅", RoomType.RTM_1R_1H);
		roomTypeMap.put("两房一厅", RoomType.RTM_2R_1H);
		roomTypeMap.put("两房两厅", RoomType.RTM_2R_2H);
		roomTypeMap.put("三房一厅", RoomType.RTM_3R_1H);
		roomTypeMap.put("三房二厅", RoomType.RTM_3R_2H);
		
		//rentType
		rentTypeMap.put("一押一付", LandlordConstant.ROOM_RENTTYPE_1T1);
		rentTypeMap.put("两押一付", LandlordConstant.ROOM_RENTTYPE_2T1);
		rentTypeMap.put("三押一付", LandlordConstant.ROOM_RENTTYPE_3T1);
		rentTypeMap.put("四押一付", LandlordConstant.ROOM_RENTTYPE_4T1);
		rentTypeMap.put("一押两付", LandlordConstant.ROOM_RENTTYPE_1T2);
		rentTypeMap.put("两押两付", LandlordConstant.ROOM_RENTTYPE_2T2);
		rentTypeMap.put("三押两付", LandlordConstant.ROOM_RENTTYPE_3T2);
		rentTypeMap.put("四押两付", LandlordConstant.ROOM_RENTTYPE_4T2);
		rentTypeMap.put("一押三付", LandlordConstant.ROOM_RENTTYPE_1T3);
		rentTypeMap.put("两押三付", LandlordConstant.ROOM_RENTTYPE_2T3);
		rentTypeMap.put("三押三付", LandlordConstant.ROOM_RENTTYPE_3T3);
		rentTypeMap.put("四押三付", LandlordConstant.ROOM_RENTTYPE_4T3);
		
		//genderType
		genderTypeMap.put("未知", LandlordConstant.GENDER_UNKOWN);
		genderTypeMap.put("男", LandlordConstant.GENDER_MALE);
		genderTypeMap.put("女", LandlordConstant.GENDER_FEMALE);
	}
	
	public static Integer getRoomType(String typeText)
	{
		Integer v = roomTypeMap.get(typeText);
		return (v == null) ? RoomType.RTM_1R_0H : v;
	}
	
	public static Integer getRentType(String typeText)
	{
		Integer v = rentTypeMap.get(typeText);
		return (v == null) ? LandlordConstant.ROOM_RENTTYPE_1T1 : v;
	}
	
	public static Integer getGenderType(String typeText)
	{
		Integer v = genderTypeMap.get(typeText);
		return (v == null) ? LandlordConstant.GENDER_UNKOWN : v; 
	}
}
